package com.qh.yyxt.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.qh.yyxt.entity.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class BorrowThingDTO
{
    //审批详情或者取走详情 或者归还详情
    @JsonProperty("fid")
    private Integer fid;
    @JsonProperty("mes")
    private String mes;
    @JsonProperty("applicant")
    private String applicant;
    @JsonProperty("college")
    private String college;
    @JsonProperty("tel")
    private String tel;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date applyTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date startTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date endTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date passTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date returnTime;
    @JsonProperty("approver")
    private String approver;
    //它的state取决去
    @JsonProperty("state")
    private String state;
    ///后续添加
    @JsonProperty("examineState")//借用状态
    private String examineState;
    @JsonProperty("activityname")//活动名称
    private String activityname;
    @JsonProperty("damageis")
    private Boolean damageis;//是否损坏
    @JsonProperty("borrowplace")//借用地点
    private String borrowplace;
    @JsonProperty("damage")//损坏情况
    private String damage;
    @JsonProperty("needReturnSigns")
    private String needReturnSigns;//需要归还物品编号
    @JsonProperty("allReturnSigns")
    private String allReturnSigns;//借用的总物品编号
    @JsonProperty("alreadyReturnSign")
    private String alreadyReturnSign;//寂静归还的物品编号


    private List<TableDTO> list=new ArrayList<>();
    public void setBorrowThingDTO(Flag flag,List<TableDTO> list)
    {
        if(flag!=null)
        {
            this.fid=flag.getId();
            this.mes=flag.getMes();
            this.applicant=flag.getApplicant();
            this.college=flag.getCollege();
            this.tel=flag.getTel();
            this.applyTime=flag.getApplytime();
            this.startTime=flag.getStarttime();
            this.endTime=flag.getEndtime();
            this.passTime=flag.getPasstime();
            this.approver=flag.getApprover();
            this.state=flag.getState();
            this.returnTime=flag.getReturntime();
            this.examineState=flag.getExamineState();
            this.activityname=flag.getActivityname();
            this.damageis = flag.getDamageis();
            this.needReturnSigns=flag.getNeedReturnSigns();
            this.allReturnSigns=flag.getAllReturnSigns();
            this.alreadyReturnSign=flag.getAlreadyReturnSign();
        }
        if(list!=null)
        this.list=list;
    }
}
